from cart.models import CartModel
from rest_framework import serializers

class CartSerializer(serializers.ModelSerializer):
    cake_lst = serializers.SerializerMethodField(read_only=True)
    def get_cake_lst(self, obj):
        return {'name':obj.cname.kname,'price':obj.cname.price,'quality':obj.cname.quality,'weight':obj.cname.weight,'cover':'http://127.0.0.1:8000/uploads/'+str(obj.cname.cover)}
    class Meta:
        model = CartModel
        fields = "__all__"